import { nanoid } from "nanoid"

export const icons = [
  {
    type: 'BaseShape',
    shape: 'Text',
    iconPath: './konvaImgs/text.png',
    id: nanoid(),
    title: '文本',
    attrs: {
      text: 'Please input text',
      fontSize: 20
    }
  },
  {
    type: 'BaseShape',
    shape: 'RegularPolygon',
    iconPath: './konvaImgs/delta.png',
    id: nanoid(),
    title: '三角形',
    attrs: {
      sides: 3,
      radius: 20,
      fill: 'transparent',
      stroke: '#000000',
      strokeWidth: 2
    }
  },
  {
    type: 'BaseShape',
    shape: 'Circle',
    iconPath: './konvaImgs/circle.png',
    id: nanoid(),
    title: '圆圈',
    attrs: {
      radius: 20,
      fill: '#000000',
      stroke: '#000000',
      strokeWidth: 2
    }
  },
  {
    type: 'Line',
    iconPath: './konvaImgs/Line.png',
    id: nanoid(),
    title: '线段'
  },
  {
    shape: 'break',
    type: 'CustomShape',
    iconPath: './konvaImgs/breaks.png',
    id: nanoid(),
    title: '开关',
    fill: 'transparent',
    stroke: '#000000',
    width: 50,
    height: 10,
    strokeWidth: 2,
    sceneFuncStr: `
      context.beginPath()
      context.moveTo(0, 5)
      context.lineTo(10, 5)
      context.rect(10, 0, 30, 10)
      context.moveTo(40, 5)
      context.lineTo(50, 5)
      context.fillStrokeShape(shape)
      context.closePath()`
  },
  {
    shape: 'handcar',
    type: 'CustomShape',
    iconPath: './konvaImgs/handcar.png',
    id: nanoid(),
    title: '手车',
    fill: 'transparent',
    stroke: '#000000',
    width: 100,
    height: 20,
    strokeWidth: 2,
    sceneFuncStr: `
      context.beginPath()
      context.moveTo(0, 10)
      context.lineTo(50, 10)
      context.moveTo(50, 10)
      context.lineTo(30, 0)
      context.moveTo(50, 10)
      context.lineTo(30, 20)
      context.moveTo(70, 10)
      context.lineTo(100, 10)
      context.moveTo(70, 10)
      context.lineTo(50, 0)
      context.moveTo(70, 10)
      context.lineTo(50, 20)
      context.fillStrokeShape(shape)
      `
  },
  {
    type: 'Image',
    iconPath: './konvaImgs/transformer.png',
    id: nanoid(),
    width: 118,
    height: 118,
    title: '变压器'
  },
  {
    type: 'Image',
    iconPath: './konvaImgs/test.svg',
    id: nanoid(),
    width: 118,
    height: 118,
    title: 'svg测试'
  }
]